﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UlsStudio.Engine
{
    /// <summary>
    /// Solution constants.
    /// </summary>
    public static class Constants
    {
        /// <summary>
        /// ULS file search-pattern
        /// </summary>
        public static string ULS_LOG_SEARCH_PATTERN { get { return "*.log"; } }

        /// <summary>
        /// ULS file search-pattern
        /// </summary>
        public static int ULS_ENTRY_EXPECTED_TOKEN_COUNT { get { return 8; } }

        /// <summary>
        /// For ParseExact on ULS date/time
        /// </summary>
        public static string ULS_DATE_FORMAT { get { return "M/dd/yyyy H:mm:s.ff"; } }      //  http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

        public static string ELPISE { get { return "..."; } }
        public static string CONTINUATION { get { return "*"; } }
        public static int CONTINUATION_POSITION { get { return 22; } }

        public static int MAX_PARSER_THREADS { get { return 2; } }

        public static int UPDATE_SECONDS { get { return 5; } }

        // Raise update event every X lines processed
        public static int UPDATE_FILE_LOADEDED_STATS { get { return 5000; } }

        // Column indexes
        public static int ULS_COL_IDX_TIME { get { return 0; } }
        public static int ULS_COL_IDX_PROCESS { get { return 1; } }
        public static int ULS_COL_IDX_TID { get { return 2; } }
        public static int ULS_COL_IDX_AREA { get { return 3; } }
        public static int ULS_COL_IDX_CATEGORY { get { return 4; } }
        public static int ULS_COL_IDX_EVENTID { get { return 5; } }
        public static int ULS_COL_IDX_LEVEL { get { return 6; } }
        public static int ULS_COL_IDX_MESSAGE { get { return 7; } }
        public static int ULS_COL_IDX_CORRELATION { get { return 8; } }

        //select id, TimeStamp, Message from LogData
        public static string FIELD_NAME_ID { get { return "id"; } }
        public static string FIELD_NAME_ROWID { get { return "rowid"; } }   // This can't change, ever

        public static string FIELD_NAME_TIMESTAMP { get { return "time_stamp"; } }
        public static string FIELD_NAME_PROCESS { get { return "process"; } }
        public static string FIELD_NAME_MSG { get { return "message"; } }
        public static string FIELD_NAME_PRODUCT { get { return "product"; } }
        public static string FIELD_NAME_CATEGORY { get { return "category"; } }
        public static string FIELD_NAME_CORRELATION { get { return "correlation"; } }
        public static string FIELD_NAME_EVENTID { get { return "event_id"; } }
        public static string FIELD_NAME_LEVEL { get { return "level"; } }
        public static string FIELD_NAME_SOURCE { get { return "source"; } }
        public static string FIELD_NAME_TID { get { return "thread_id"; } }
        
        public static string TABLE_NAME_LOGDATA { get { return "log"; } }

        public static int FILE_LINE_BUFFER_COUNT { get { return 20000; } }
        public static int FILE_LINE_BUFFER_COUNT_FIRST_HIT { get { return 2000; } }


        public static string LEVEL_VERBOSE { get { return "Verbose"; } }
        public static string LEVEL_INF { get { return "Information"; } }
        public static string LEVEL_WANRING { get { return "Medium"; } }
        public static string LEVEL_HIGH { get { return "High"; } }
        public static string LEVEL_CRITICAL { get { return "Critical"; } }
        public static string LEVEL_UNEXPECTED { get { return "Unexpected"; } }
        public static string LEVEL_EXCEPTION { get { return "Exception"; } }

        public static string FILTER_CLAUSE_VERBOSE { get { return string.Format("{0} != '{1}'", Constants.FIELD_NAME_LEVEL, Constants.LEVEL_VERBOSE); } }
        public static string FILTER_CLAUSE_INF { get { return string.Format("{0} != '{1}'", Constants.FIELD_NAME_LEVEL, Constants.LEVEL_INF); } }
        public static string FILTER_CLAUSE_WARNING { get { return string.Format("{0} != '{1}'", Constants.FIELD_NAME_LEVEL, Constants.LEVEL_WANRING); } }
        public static string FILTER_CLAUSE_HIGH { get { return string.Format("{0} != '{1}'", Constants.FIELD_NAME_LEVEL, Constants.LEVEL_HIGH); } }
        public static string FILTER_CLAUSE_CRITICAL { get { return string.Format("{0} != '{1}'", Constants.FIELD_NAME_LEVEL, Constants.LEVEL_CRITICAL); } }
        public static string FILTER_CLAUSE_UNEXPECTED { get { return string.Format("{0} != '{1}'", Constants.FIELD_NAME_LEVEL, Constants.LEVEL_UNEXPECTED); } }
        public static string FILTER_CLAUSE_EXCEPTION { get { return string.Format("{0} != '{1}'", Constants.FIELD_NAME_LEVEL, Constants.LEVEL_EXCEPTION); } }
    }
}
